﻿#include "secondmathimplabc5.h"
#include "tools/base_math_tools.h"
SecondMathImplABC5::SecondMathImplABC5(QObject *parent)
{

}

const QString SecondMathImplABC5::fun()
{
    QString tmp ,op1,op2;
    int num1 ,num2,num3,res = -1;
    do{
     res = -1;
     num1 = BaseMathTools::generateRandomNumber(0, 100);
     num2 = BaseMathTools::generateRandomNumber(0, 100);
     num3 = BaseMathTools::generateRandomNumber(0, 100);
     op1 = BaseMathTools::getRandomOption(ADD_DESC_OPTION);
     op2 = BaseMathTools::getRandomOption(ADD_DESC_OPTION);

     int num12 = BaseMathTools::doCount(num1,num2,op1);
     if(num12 < 0 || num12 > 100){
         continue;
     }
     res = BaseMathTools::doCount(num12,num3,op2);
   }while(res > 100 || res < 0);
   tmp = QString::number(num1) + " "+op1+" " +  QString::number(num2) + " "+op2+" "+  QString::number(num3)+ " = ";
   return tmp;
}
